import 'package:equatable/equatable.dart';

class TrainingSettingsData extends Equatable {
  const TrainingSettingsData({
    required this.trainingLexicalItemMaxCount,
    required this.exerciseShuffleEnabled,
    required this.forgottenLexicalItemTrainingEnabled,
    required this.translationSelectionExerciseEnabled,
    required this.audioExerciseEnabled,
    required this.typingExerciseEnabled,
  });

  final int trainingLexicalItemMaxCount;
  final bool exerciseShuffleEnabled;
  final bool forgottenLexicalItemTrainingEnabled;
  final bool translationSelectionExerciseEnabled;
  final bool audioExerciseEnabled;
  final bool typingExerciseEnabled;

  @override
  List<Object?> get props {
    return [
      trainingLexicalItemMaxCount,
      exerciseShuffleEnabled,
      forgottenLexicalItemTrainingEnabled,
      translationSelectionExerciseEnabled,
      audioExerciseEnabled,
      typingExerciseEnabled,
    ];
  }

  TrainingSettingsData copyWith({
    int Function()? trainingLexicalItemMaxCount,
    bool Function()? exerciseShuffleEnabled,
    bool Function()? forgottenLexicalItemTrainingEnabled,
    bool Function()? translationSelectionExerciseEnabled,
    bool Function()? audioExerciseEnabled,
    bool Function()? typingExerciseEnabled,
  }) {
    return TrainingSettingsData(
      trainingLexicalItemMaxCount: trainingLexicalItemMaxCount == null
          ? this.trainingLexicalItemMaxCount
          : trainingLexicalItemMaxCount(),
      exerciseShuffleEnabled:
          exerciseShuffleEnabled == null ? this.exerciseShuffleEnabled : exerciseShuffleEnabled(),
      forgottenLexicalItemTrainingEnabled: forgottenLexicalItemTrainingEnabled == null
          ? this.forgottenLexicalItemTrainingEnabled
          : forgottenLexicalItemTrainingEnabled(),
      translationSelectionExerciseEnabled: translationSelectionExerciseEnabled == null
          ? this.translationSelectionExerciseEnabled
          : translationSelectionExerciseEnabled(),
      audioExerciseEnabled:
          audioExerciseEnabled == null ? this.audioExerciseEnabled : audioExerciseEnabled(),
      typingExerciseEnabled:
          typingExerciseEnabled == null ? this.typingExerciseEnabled : typingExerciseEnabled(),
    );
  }
}
